package com.it.data_recursion;

/**
 * @Author: CaoYouGen
 * @DateTime: 2023/05/18/13:03
 * @注释: 递归实现阶乘
 **/
public class Factorial {

    public int fn(int number){
        // 如果是 1 或者 0 阶乘都是 1
        if (number == 1 || number == 0){
            return 1;
        }
        return number * fn(number - 1);
    }

}
